const isObject = require("./04_isObject");
const { nativeKeys, nativeHasOwnProperty } = require("./08_cache");
const has = require("./09_has");

function keys(obj) {
  if (!isObject(obj)) return [];
  if (nativeKeys) {
    return nativeKeys(obj);
  }
  var keys = [];
  for (var key in obj) {
    if (has(obj, key)) {
      keys.push(key);
    }
  }
  return keys;
}

module.exports = keys;
